﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 坚山面料维护
{
    public partial class MATERIAL_Protect : DevExpress.XtraBars.Ribbon.RibbonForm
    {
        //初始化DOT数组
        public List<DTO> dTOs = new List<DTO>();
        //
        public MATERIAL_Protect()
        {
            InitializeComponent();
            //检索所有面料数据
            DataTable dt = SQl大连云.GetDataTable("SELECT\n" +
                "	id,\n" +
                "	MATERIAL_CODE \n" +
                "FROM\n" +
                "	Kashiyama_MATERIAL");
            //添加数据到DataRow中
            foreach (DataRow dr in dt.Rows)
            {
                this.dTOs.Add(new DTO(dr));
            }
            this.gridControl1.DataSource = this.dTOs;
        }


        //新增面料数据
        private void insterButton_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            new Frm面料号录入().ShowDialog();
        }
        //获取面料数据
        public class DTO
        {
            public String ID { get; set; }
            public String MATERIAL_CODE { get; set; }

            public DTO(DataRow dr)
            {
                this.ID = dr["ID"].ToString();
                this.MATERIAL_CODE = dr["MATERIAL_CODE"].ToString();
            }
        }
    }
}
